﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Northwind.NET.FE.Reports
{
    public partial class InvoiceReport1 : Form
    {
        public InvoiceReport1()
        {
            InitializeComponent();
        }

        private void InvoiceReport_Load(object sender, EventArgs e)
        {
            int? OrderID = 10368;
            simpleReportsDataSet.EnforceConstraints = false;
            this.invoiceReportTableAdapter.Fill(this.simpleReportsDataSet.InvoiceReportDataTable,OrderID);
            this.InvoiceReportViewer1.RefreshReport();
            //simpleReportsDataSet.EnforceConstraints = true;
        }

        private void InvoiceReportViewer1_Load(object sender, EventArgs e)
        {

        }

        private void PreviewButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(OrderIDTextBox.Text)) return;
            int OrderID = Int32.Parse(OrderIDTextBox.Text);
            this.invoiceReportTableAdapter.Fill(this.simpleReportsDataSet.InvoiceReportDataTable, OrderID);
            this.InvoiceReportViewer1.RefreshReport();
        }

        private void OrderIDTextBox_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(OrderIDTextBox.Text)) return;
            if (OrderIDTextBox.Text.Length < 4) return;
            int OrderID = Int32.Parse(OrderIDTextBox.Text);
            this.invoiceReportTableAdapter.Fill(this.simpleReportsDataSet.InvoiceReportDataTable, OrderID);
            this.InvoiceReportViewer1.RefreshReport();
        }
    }
}
